package com.hopes.bizz.risk.gis.controller;

import com.hopes.bizz.risk.gis.constant.RiskHidCountStatisticsTypeEnum;
import com.hopes.bizz.risk.gis.constant.RiskStatisticsCycleEnum;
import com.hopes.bizz.risk.gis.service.GisService;
import com.hopes.bizz.risk.gis.vo.*;
import com.hopes.boss.common.core.util.R;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

/**
 * @author lyb
 * @version 1.0
 * @date 2024/2/23 10:20
 */

@RestController
@RequiredArgsConstructor
@RequestMapping("/gis")
@Tag(description = "gis", name = "gis一张图统计")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class GisController {

    private final GisService gisService;

    /**
     * @Description 风险对象统计
     * @Author lyb
     * @Date 2024/2/23
     **/
    @GetMapping(value = "calculateRiskObjectLevelStatistics")
    public R calculateRiskObjectLevelStatistics() {
        RiskObjectLevelStatistics riskObjectLevelStatistics = gisService.calculateRiskObjectLevelStatistics();
        return R.ok(riskObjectLevelStatistics);
    }

    /**
     * @Description 隐患多维度统计
     * @Author lyb
     * @Date 2024/2/23
     **/
    @GetMapping(value = "calculateRiskHidCountStatistics/{type}")
    public R calculateRiskHidCountStatistics(@PathVariable RiskHidCountStatisticsTypeEnum type) {
        RiskHidCountStatistics riskHidCountStatistics = gisService.calculateRiskHidCountStatistics(type);
        return R.ok(riskHidCountStatistics);
    }

    /**
     * @Description 隐患任务趋势统计
     * @Author lyb
     * @Date 2024/2/23
     **/
    @GetMapping(value = "calculateRiskTaskTrendStatistics/{cycle}")
    public R calculateRiskTaskTrendStatistics(@PathVariable RiskStatisticsCycleEnum cycle) {
        LineStatistics riskTaskTrendStatistics = gisService.calculateRiskTaskTrendStatistics(cycle);
        return R.ok(riskTaskTrendStatistics);
    }

    /**
     * @Description 隐患整改趋势
     * @Author lyb
     * @Date 2024/2/23
     **/
    @GetMapping(value = "calculateRiskHidRectifyTrendStatistics/{cycle}")
    public R calculateRiskHidRectifyTrendStatistics(@PathVariable RiskStatisticsCycleEnum cycle) {
        LineStatistics riskHidRectifyTrendStatistics = gisService.calculateRiskHidRectifyTrendStatistics(cycle);
        return R.ok(riskHidRectifyTrendStatistics);
    }


    @GetMapping(value = "calculateRiskHidStatistics/{cycle}")
    public R calculateRiskHidStatistics(@PathVariable RiskStatisticsCycleEnum cycle) {
        RiskHidStatusStatistics riskHidStatistics = gisService.calculateRiskHidStatistics(cycle);
        return R.ok(riskHidStatistics);
    }

}
